<?php

namespace App\Http\Models;


class SpaceShare extends BaseMessage
{

    protected $table = 'tspaceshare';
    protected $fillable = ['SSTitle', 'SSSpaceID', 'SSMessage', 'SSPayType', 'SSBeginAT', 'SSLimit', 'SSCustomerID'];
    protected $guarded = ['fid'];
    public static $rule = array(
        'SSMessage' => 'required',
        'SSPayType' => 'required',
        'SSBeginAT' => 'required',
        'SSCustomerID' => 'required|numeric|min:0',
    );

    public function getList()
    {
        return self::where('SSBeginAT', '>=', date('Y-m-d', time()))->orderBy('SSBeginAT')->paginate(5);
    }

    public function getMylist()
    {
        return self::where('SSCustomerID', \Illuminate\Support\Facades\Session::get('customer_id'))->orderBy('SSID', 'desc')->paginate(5);
    }

}
